<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Send_email {
	//configuring
	var $protocol		= 'smtp';
	var $smtp_host		= 'ssl://smtp.googlemail.com';
	var $smtp_port		= '465';
	var $mailtype		= 'html';
	var $smtp_user		= '';
	var $smtp_pass		= '';
	var $charset		= 'utf-8';
	var $from			= 'no-reply@meltzz.web.id';
	var $from_name		= 'Intan Jaya Kencana';
	
	private static $ci;
	function __construct() {
	    self::$ci = get_instance();
	} //
	
	public static function send_email($to,$subject,$message, $reply_to = ''){
		self::$ci->load->library('email');
		$config['smtp_host'] = $this->smtp_host;
		$config['smtp_user'] = $this->smtp_user;
		$config['smtp_pass'] = $this->smtp_pass;

		$config['charset'] = $this->charset;
		$config['protocol'] = $this->protocol;
		$config['mailtype'] = $this->mailtype;
		
		self::$ci->email->initialize($config);
		self::$ci->email->from($this->from, $this->from_name);
		self::$ci->email->to($to);
		if($reply_to != '') $this->email->reply_to($reply_to);
		self::$ci->email->subject($subject);
		self::$ci->email->message($message);
		self::$ci->email->send();
	}
}